<template>
  <el-dialog title="创建成功，但部分商品失败" v-model="dialogVisible" size="tiny">
    <p>温馨提示：创建成功，但部分商品由于在同一个时间已存在立减活动，关联失败</p>
    <hr>
    <p>失败的商品与存在冲突的活动对应如下：</p>
    <el-table :data="failProductList">
      <el-table-column property="productId" label="spu编号" width="150"></el-table-column>
      <el-table-column property="productTitle" label="商品名称" width="200"></el-table-column>
      <!-- <el-table-column property="address" label="冲突活动"></el-table-column> -->
    </el-table>
    <p>把商品从冲突活动中剔除，直接捆绑本次活动</p>
    <span slot="footer" class="dialog-footer">
      <el-button @click="dialogVisible = false">忽略</el-button>
      <el-button type="primary" @click="submit()">确 认</el-button>
    </span>
  </el-dialog>
</template>
<script>
  import {
    savePriceStrategyConfirmConflict
  } from 'src/api/index.js'
  export default {
    data () {
      return {
        failProductList: [],
        cacheKey: '',
        dialogVisible: false
      }
    },
    methods: {
      callPanel (failProductList, cacheKey) {
        this.failProductList = failProductList || []
        this.cacheKey = cacheKey || ''
        this.dialogVisible = true
      },
      submit () {
        this.dialogVisible = false
        savePriceStrategyConfirmConflict({
          cacheKey: this.cacheKey
        }).then((res) => {
          let result = res.data
          if (result.code === 100) {
            this.$alert('处理成功', {
              confirmButtonText: '确定',
              callback: action => {
                this.$router.push({
                  path: '/operational/activitiesList'
                })
              }
            })
          } else {
            this.$alert(result.message)
          }
        })
      }
    }
  }
</script>
<style>

</style>
